# a=eval(input(“请输入一个正整数：“))
def isPrime(n):
    if n <= 1:
        return False
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True


n = 0
m = 11
while n < 100:

    if isPrime(m) and str(m) == str(m)[::-1]:
        n += 1
        print('{:>6}'.format(m), end=' ' if n % 10 else '\n')
    m += 1
